﻿// JScript 文件


//选择产品类型,设置产品类型价格
function chooseBuyNum(id)
{
	

	var catrSum=0;
	var catrPrice=0;
	var catrNum=0
       
    var basePrice=document.check.strbasePrice.value;
    var strproprice19=document.check.proprice19.value;
    var strproprice20=document.check.proprice20.value;
    var strproprice21=document.check.proprice21.value;
    var strproprice34=document.check.proprice34.value;
    var strproprice35=document.check.proprice35.value;
    var strproprice36=document.check.proprice36.value;
    var strproprice37=document.check.proprice37.value; 
    
         basePrice=getFloat(basePrice,2);
        strproprice19=getFloat(strproprice19,2);
        strproprice20=getFloat(strproprice20,2);
        strproprice21=getFloat(strproprice21,2);
        strproprice34=getFloat(strproprice34,2);
        strproprice35=getFloat(strproprice35,2);
        strproprice36=getFloat(strproprice36,2);
        strproprice37=getFloat(strproprice37,2);
       
       catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
	//alert(BuySum);
	 
         if(basePrice==0){
        //callServerprice(id);              //  selectprice.asp?t=6&id="+p;
        // callServerpricetj(id,catrNum);   // selectprice.asp?t=7&id="+p+"&n="+num;

        }else{

        var  mybasePrice=0;

        if(strproprice34>0){
         mybasePrice=(parseFloat(strproprice34)+parseFloat(strproprice19)+parseFloat(strproprice20)+parseFloat(strproprice21)+parseFloat(strproprice35)+parseFloat(strproprice36)+parseFloat(strproprice37));
			
                        
		}
       else{

         
         mybasePrice=(parseFloat(basePrice)+parseFloat(strproprice19)+parseFloat(strproprice20)+parseFloat(strproprice21)+parseFloat(strproprice35)+parseFloat(strproprice36)+parseFloat(strproprice37));           

            }
       

    



    var alltotalprice=getFloat(mybasePrice*catrNum,2);




      document.getElementById("pamount_"+id).value=catrNum;
        	

        strbuypeijianprice=  $("buypeijianprice").value;
          
       strtotalprice=parseFloat(getFloat(alltotalprice,2))+parseFloat(getFloat(strbuypeijianprice,2));

       
	$('SumMoney').style.display='';
	$('SumMoney').innerHTML=''+getFloat(alltotalprice,2)+'';
       $('buysummoney').value=getFloat(alltotalprice,2);
        $('buygouwuprice').value=getFloat(alltotalprice,2);  
         $('peijianprice').innerHTML=''+getFloat(strbuypeijianprice,2)+'';
        $('buypeijianprice').value=getFloat(strbuypeijianprice,2);
        $('gouwuprice').innerHTML=''+getFloat(alltotalprice,2)+'';       
         $('allprice').innerHTML=''+getFloat(alltotalprice,2)+'';
        $('buytotalprice').value=getFloat(alltotalprice,2);

        }
        

        
        
	
}

function baseprice(id)
{
  var id;
  callServerprice(id);
}




function basepricelist(id)
{
  var id;
  callServerprice(id);
}

function choosepcolor(pcolorid)
{	
        var  pcolorid,brandsid2,t2i
         t2i=$('pid_2_t2').value;
	
        var id
	var catrBasePrice=0;
        var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
        var pid=0;
        var catrNum=0;
        id=$('id').value;
        //callServerbasicprice(id);
         pprice=$("proprice_2_"+pcolorid).value;
         xhprice=$('xhprice').value;
           catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;

        catrBasePrice=$('basePrice').value;
	//设置当成点击为选中
	$("pcolors"+pcolorid).className='pcolorCurrent';
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t2i;i++){
		if(i!=pcolorid){
			$("pcolors"+i).className='pcolor';
                       
		}
                else{
			$("pcolors"+i).className='pcolorCurrent';
                         $("pid_2_"+i).checked='true';
                         pid=$("pid_2_"+i).value;

                         brandsid2=$('pid_2_brandsID').value;
                       $("pid_"+brandsid2+"_"+id).value=pid;
                       callServercolorselect(pid); 
                        
                }

               }
            
                      
               

selectguige(pid);
	
       }  


	
function choosesizecolor(sizecolorid)
{	
         var  sizecolorid,brandsid3,t3i
        var id
	var catrBasePrice=0;
        id=$('id').value;
        var pprice=0
         var xhpprice=0;
        var pid=0;
        var catrNum=0;
        var strpeijianprice=0;
        catrBasePrice=$('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
         pprice=$("proprice_3_"+sizecolorid).value;
           catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
         t3i=$('pid_3_t3').value;
	//设置当成点击为选中
	$("sizecolors"+sizecolorid).className='sizecolorCurrent';
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t3i;i++){
		if(i!=sizecolorid){
			$("sizecolors"+i).className='sizecolor';
                       
		}
                else{
			$("sizecolors"+i).className='sizecolorCurrent';
                       $("pid_3_"+i).checked='true';
                      
                     pid=$("pid_3_"+i).value;
                     brandsid3=$('pid_3_brandsID').value;
                       $("pid_"+brandsid3+"_"+id).value=pid;

                     callServersizeselect(pid); 

                  
		
	      }

            }

       
                

selectguige(pid);
	
                       
          }



	
function choosexinghaocolor(xinghaocolorid)
{	
         var  xinghaocolorid,brandsid4,t4i
        var id
	var catrBasePrice=0;
        var xhprice=0;
        var pprice=0;
        var strpeijianprice=0;
        var catrNum=0;
        var pid=0;
        id=$('id').value;
        catrBasePrice=$('strbasePrice').value;
        pprice=$('pprice').value;
        //callServerbasicprice(id,catrBasePrice);
           catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
        //  strpeijianprice=$("buypeijianprice").value;

         t4i=$('pid_4_t4').value;
	//设置当成点击为选中
	$("xinghaocolors"+xinghaocolorid).className='xinghaocolorCurrent';
            brandsid4=$('pid_4_brandsID').value;
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t4i;i++){


		if(i!=xinghaocolorid){
			$("xinghaocolors"+i).className='xinghaocolor';
                        
		}
                else{

                       $("xinghaocolors"+i).className='xinghaocolorCurrent';

                   
                      pid=$("pid_4_"+i).value;  
                      
                      

                        xhprice=$("proprice_4_"+i).value;
                        $("pid_4_"+i).checked='true';

                          brandsid4=$('pid_4_brandsID').value;
                       $("pid_"+brandsid4+"_"+id).value=pid;
                   callServerxhselect(pid); 

                  
                  
                     
            
		}
	}



                  
             
selectguige(pid);

       }  


function choosetccolor(tccolorid)
{	
         var  tccolorid,brandsid5,t5i,pid
        var id=0;
	var catrBasePrice=0;
        var pprice=0;
        var xhpprice=0;
        var strpeijianprice=0;
        var catrNum=0;
        id=$('id').value;
        var pid=0;
         pprice=$("proprice_5_"+tccolorid).value;
         xhprice=$('xhprice').value;
           catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
         // strpeijianprice=$("buypeijianprice").value;
	//alert(BuySum);
         t5i=$('pid_5_t5').value;

       
	//设置当成点击为选中
	$("tccolors"+tccolorid).className='tccolorCurrent';

        brandsid5=$('pid_5_brandsID').value;

                    

        
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t5i;i++){

		if(i!=tccolorid){
			$("tccolors"+i).className='tccolor';
                      
		}
                else{
			

                       $("tccolors"+i).className='tccolorCurrent';
                        pid=$("pid_5_"+i).value;
                     $("pid_5_"+i).checked='true';
                        $("pricename_5_"+i).value='tccolorCurrent';
                          brandsid5=$('pid_5_brandsID').value;
                       $("pid_"+brandsid5+"_"+id).value=pid;
                    
                       
                      
                   }  

                      // callServerbasicprice(id);
                    // callServerpricetj(id,catrNum);   // selectprice.asp?t=7&id="+p+"&n="+num;
                      // callServerpricetjpjbp(id,pid,catrNum);   // 
                       

                      $("pid_"+brandsid5+"_"+id).value=pid;


                       callServertcselect(pid); 
                         
  
                      }
                        
selectguige(pid);
       }  



function choosepjcolor(pjcolorid)
{	
         var  pjcolorid
         var  price
         var  strprice
         var  t6i
        var id
         var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
	var catrBasePrice=0;
        var pid=0;
        id=$('id').value;
        catrBasePrice=$('basePrice').value;
        //callServerbasicprice(id,catrBasePrice);
      pprice=$("proprice_6_"+pjcolorid).value;
  catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
         t6i=$('pid_6_t6').value;
	strprice=$('basePrice').value;
	//设置当成点击为选中
	$("pjcolors"+pjcolorid).className='pjcolorCurrent';
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t6i;i++){
		if($("pid_6_"+i).checked!='true'){
			$("pjcolors"+i).className='pjcolor';
                       pprice=$("proprice"+i).value;
                         
                       strprice=Number(strprice)-Number(pprice);
                       $("pid_6_"+i).checked='flase';
		}
                else{
			$("pjcolors"+i).className='pjcolorCurrent';
                       $("pid_6_"+i).checked='true';
                         pprice=$("proprice"+i).value;
                         
                        strprice=Number(strprice)+Number(pprice);
                        pid=$("pid_6_"+i).value;
                        brandsid6=$('pid_6_brandsID').value;
                       $("pid_"+brandsid6+"_"+id).value=pid;
                       callServerpjselect(pid)
		}
	}
       
      
      $('basePrice').value=strprice
     
selectguige(pid);
       }  
function chooselongcolor(longcolorid)
{	
         var  longcolorid,brandsid7,t7i
        var id
        var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
	var catrBasePrice=0;
        id=$('id').value;
        var pid=0;
        catrBasePrice=$('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
       pprice=$("proprice_7_"+longcolorid).value;
  catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
         t7i=$('pid_7_t7').value;
	//设置当成点击为选中
	$("longcolors"+longcolorid).className='longcolorCurrent';
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t7i;i++){
		if(i!=longcolorid){
			$("longcolors"+i).className='longcolor';
                       
		}
                else{
			$("longcolors"+i).className='longcolorCurrent';
                       $("pid_7_"+i).checked='true';
                      
                      pid=$("pid_7_"+i).value;
                      brandsid7=$('pid_7_brandsID').value;
                       $("pid_"+brandsid7+"_"+id).value=pid;

                   callServerlongselect(pid)
		
	      }

            }
       
             

selectguige(pid);
                       
          }

function choosewidthcolor(widthcolorid)
{	
         var  longcolorid,brandsid8,t8i
        var id
        var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
	var catrBasePrice=0;
        var pid=0;
        id=$('id').value;
        catrBasePrice=$('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
        pprice=$("proprice_8_"+widthcolorid).value;
  catrNum=$('BuyNum').options[$('BuyNum').selectedIndex].value;
         t8i=$('pid_8_t8').value;
	//设置当成点击为选中
	$("widthcolors"+widthcolorid).className='widthcolorCurrent';
	//撤消除当前点击以外的选中状态
	for(var i=0;i<t8i;i++){
		if(i!=widthcolorid){
			$("widthcolors"+i).className='widthcolor';
                       
		}
                else{
			$("widthcolors"+i).className='widthcolorCurrent';
                       $("pid_8_"+i).checked='true';
                      
                      pid=$("pid_8_"+i).value;
                      brandsid8=$('pid_8_brandsID').value;
                       $("pid_"+brandsid8+"_"+id).value=pid;
                           
                   callServerwidthselect(pid)
		
	      }

            }
       
selectguige(pid);
                       
          }

function choosekxpj(kxpjid)
{	
       
         var  pprice
         var  price
         var  strprice
         var  pok
         var id
	var catrBasePrice=0;
        var buygouwuprice=0;
        var buypeijianprice=0;
        var buytotalprice=0;
        var buysummoney=0;

       
       // catrBasePrice=$('basePrice').value;

        //callServerbasicprice(id,catrBasePrice);

            


	//设置当成点击为选中
	
	//撤消除当前点击以外的选中状态

                 pok=$("pjid_"+kxpjid).checked;
                 //document.getElementById("downname").value;
                 

                if($(pok)!=true) {
                   
                   delpeijian(kxpjid);

                       alert('已经移除！');
                }
                else{


             

                  addpeijian(kxpjid);
                 

                 alert('已经选定！');
            }
                              
                        

	
 }  


function fastaddcart(id)
{	
       
         var  pprice
         var  price
         var  strprice
         var  pok
       
	var catrBasePrice=0;
        var buygouwuprice=0;
        var buypeijianprice=0;
        var buytotalprice=0;
        var buysummoney=0;

       
       // catrBasePrice=$('basePrice').value;

        //callServerbasicprice(id,catrBasePrice);
         addtofastcart(id);
          
          alert('已经加入购物车！');        

 }  



function addmycart(id)
{	
         var  addid
         var  pprice
         var  price
         var  strprice
         var  pok
        var id
	var catrBasePrice=0;
        id=$('id').value;
        catrBasePrice=$('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
	callServeraddmycart(id);
       // callServeraddbottomcart(id);
        //mycartlist();
        //  alert('已经加入购物车！');
           
 }  


function chooseown(mpid)
{	
  
        
	var vallprice=0; 
        var vprice=0; 
        var strtotalprice=0;
        var checkedid=0;
        var allpid;
        var chok='false'
       // var  document.getElementById('ownid_'+mpid).checked=true;
 
        //allpid=document.getElementById("pid").value;
            
        vprice=document.getElementById('pidprice_'+mpid).value;
        vallprice=document.getElementById("vallprice").value;
         //checkedid=document.getElementById("checkedpid").value;
         checkedid=mpid;

        
          chok= document.getElementById("ownid_"+mpid).checked;

         // var   pok=("ownid_"+mpid).checked;

          if ((chok)!=true) {

          strtotalprice=parseFloat(getFloat(vallprice,2))-parseFloat(getFloat(vprice,2));
          

          }
      else{
        strtotalprice=parseFloat(getFloat(vallprice,2))+parseFloat(getFloat(vprice,2));
          
          }

       
        
	 document.getElementById("allprice").innerHTML=''+getFloat(strtotalprice,2)+''; 
         document.getElementById("vallprice").value=getFloat(strtotalprice,2);
         document.getElementById("checkedpid").value=chok;
         
           
 }  



function choosediy(mpid,bid)
{	
  
        
	var vallprice=0; 
        var vprice=0; 
        var strtotalprice=0;
        var checkedid=0;
        var allpid;
        var chok='false';
        var cmpid=0;
        var t=0
       // var  document.getElementById('diyid_'+mpid).checked=true;
 
        //allpid=document.getElementById("spid").value;
            
        vprice=document.getElementById('pidprice_'+mpid).value;
        vallprice=document.getElementById("vallprice").value;
         //checkedid=document.getElementById("checkedpid").value;
         checkedid=mpid;

        
          chok= document.getElementById("diyid_"+mpid).checked;

         // var   pok=("diyid_"+mpid).checked;

       
        //strtotalprice=parseFloat(getFloat(vallprice,2))+parseFloat(getFloat(vprice,2));
          cmpid=mpid
          t=1;
         

       
        
	// document.getElementById("allprice").innerHTML=''+getFloat(strtotalprice,2)+''; 
        // document.getElementById("vallprice").value=''+getFloat(strtotalprice,2)+'';
         document.getElementById("spidprice_"+bid).value=getFloat(vprice,2);
         document.getElementById("spidprice_"+bid).innerHTML=''+getFloat(vprice,2)+'';
        document.getElementById("pid_"+bid).value=cmpid;
         document.getElementById("checkedpid").value=chok;
       ajaxdiy(mpid,bid,t);
    
         
           
 } 




function diydel(mpid,bid)
{	
  
        
	var vallprice=0; 
        var vprice=0; 
        var strtotalprice=0;
        var checkedid=0;
        var allpid;
        var chok='false';
        var cmpid=0;
        var t=0
       // var  document.getElementById('diyid_'+mpid).checked=true;
 
        //allpid=document.getElementById("spid").value;
            
        vprice=0;
        vallprice=0;
         //checkedid=document.getElementById("checkedpid").value;
         checkedid=mpid;

        
         // chok= document.getElementById("diyid_"+mpid).checked;

         // var   pok=("diyid_"+mpid).checked;

       
        //strtotalprice=parseFloat(getFloat(vallprice,2))+parseFloat(getFloat(vprice,2));
          cmpid=mpid
          t=0;
         

       
        
	// document.getElementById("allprice").innerHTML=''+getFloat(strtotalprice,2)+''; 
        // document.getElementById("vallprice").value=''+getFloat(strtotalprice,2)+'';
         document.getElementById("spidprice_"+bid).value=0;
         document.getElementById("spidprice_"+bid).innerHTML=0;
        document.getElementById("pid_"+bid).value="";
         document.getElementById("pamount_"+mpid).value=1;
       //  document.getElementById("checkedpid").value=chok;
       ajaxdiy(mpid,bid,t);
    
         
           
 }  

function diyNumberChange(pid)
{	
  pamount=document.getElementById('pamount_'+pid).value;
   nid=pamount;


   ajaxdiynum(pid,nid);
 } 


  var xmlHttp0 = false;
 try {
  xmlHttp0 = new ActiveXObject("Msxml2.XMLHTTP.3.0");
 } catch (e) {
  try {
    xmlHttp0 = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (e2) {
   xmlHttp0 = false;
 }
}
if (!xmlHttp0 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp0 = new XMLHttpRequest();
}

//触发初始商品基本价更新
function callServertcprice(pid) {
  
 var url = "../../selectprice.asp?t=0&id="+pid;

 xmlHttp0.open("GET", url, true);

xmlHttp0.onreadystatechange = updatePagetcprice;
  xmlHttp0.send(null);  
  
}

function updatePagetcprice() {
 if (xmlHttp0.readyState < 4) {
	//document.check.basePrice.value="0";
       
 }
 if (xmlHttp0.readyState == 4) {


   var str = xmlHttp0.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var basePrice=strs[0];
    var strbasePrice=strs[1];

   var allprice=strbasePrice


   // document.check.basePrice.value==20;
   // document.check.strbasePrice.value=strbasePrice;
    SumMoney.innerHTML=allprice;
    allprice.innerHTML=allprice;
    gouwuprice.innerHTML=allprice;
     document.check.buysummoney.value=allprice;
      document.check.buytotalprice.value=allprice;
      document.check.buygouwuprice.value=allprice;
 }
}


//触发初始商品基本价更新
function callServerbasicprice(id) {
  
 var url = "../../selectprice.asp?t=0&id="+id;

 xmlHttp0.open("GET", url, true);

xmlHttp0.onreadystatechange = updatePagebasicprice;
  xmlHttp0.send(null);  
  
}

function updatePagebasicprice() {
 if (xmlHttp0.readyState < 4) {
	document.check.basePrice.value="0";
       
 }
 if (xmlHttp0.readyState == 4) {
   var str = xmlHttp0.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  
    
    var basePrice=strs[0];
    var strbasePrice=strs[1];
    var allprice=strbasePrice
    document.check.basePrice.value=basePrice;
    document.check.strbasePrice.value=strbasePrice;
    SumMoney.innerHTML=allprice;
    allprice.innerHTML=allprice;
    gouwuprice.innerHTML=allprice;
     document.check.buysummoney.value=allprice;
      document.check.buytotalprice.value=allprice;
      document.check.buygouwuprice.value=allprice;
 }
}




var xmlHttp5 = false;
try {
  xmlHttp5 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp5 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp5 = false;
  }
}
if (!xmlHttp5 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp5 = new XMLHttpRequest();
}


//更新套餐选定状态
function callServertcselect(p) {
  
  var url = "../../select.asp?t=4&id="+p;

  xmlHttp5.open("GET", url, true);
  xmlHttp5.onreadystatechange = updatePagetcselect;
  xmlHttp5.send(null);  
  
}

function updatePagetcselect() {
  if (xmlHttp5.readyState < 4) {
	document.getElementById("yixuantaocan").innerHTML="";
  }
  if (xmlHttp5.readyState == 4) {
    

   var str = xmlHttp5.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
   var selectpic=strs[1];
   var sok=strs[2];
   var sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuantaocan").innerHTML=selectname;
}
if(sok==1){
   document.getElementById("zhanshipic").innerHTML=selectpic1;
}

  }
}

var xmlHttp2 = false;
try {
  xmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp2 = false;
  }
}
if (!xmlHttp2 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp2 = new XMLHttpRequest();
}


//更新型号选定状态
function callServerxhselect(p) {
  
  var url = "../../select.asp?t=3&id="+p;

  xmlHttp2.open("GET", url, true);
  xmlHttp2.onreadystatechange = updatePagexhselect;
  xmlHttp2.send(null);  
  
}

function updatePagexhselect() {
  if (xmlHttp2.readyState < 4) {
	document.getElementById("yixuanxinghao").innerHTML="";
  }
  if (xmlHttp2.readyState == 4) {

 var str = xmlHttp2.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

    var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    var sok=parseInt(sok)

  var titleselectname=selectname.replace("+","");  

selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuanxinghao").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}




  }
}


var xmlHttp3 = false;
try {
  xmlHttp3 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp3 = false;
  }
}
if (!xmlHttp3 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp3 = new XMLHttpRequest();
}



//价格初始化小计统计
function callServerpricetj(p,num) {
  
  var url = "../../selectprice.asp?t=9&id="+p+"&n="+num;

  xmlHttp3.open("GET", url, true);
  xmlHttp3.onreadystatechange = updatePagepricetj;
  xmlHttp3.send(null);  
  
}

function updatePagepricetj() {
  if (xmlHttp3.readyState < 4) {
	
         SumMoney.innerHTML="价格初始化小计统计";
  }
  if (xmlHttp3.readyState == 4) {
    var response = xmlHttp3.responseText;
    
     SumMoney.innerHTML=response;
    allprice.innerHTML=response;
    gouwuprice.innerHTML=response;
     document.check.buysummoney.value=response;
      document.check.buytotalprice.value=response;
      document.check.buygouwuprice.value=response;
  }
}

var xmlHttp4 = false;
try {
  xmlHttp4 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp4 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp4 = false;
  }
}
if (!xmlHttp4 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp4 = new XMLHttpRequest();
}



//选定官方标配价格综合统计
function  callServerpricetjpjbp(id,pid,num) {
  
  var url = "../../addcarttjpjbp.asp?pid="+pid+"&id="+id+"&n="+num;

  xmlHttp4.open("GET", url, true);
  xmlHttp4.onreadystatechange = updatePagepricetjpjbp;
  xmlHttp4.send(null);  
  
}

function updatePagepricetjpjbp() {
  if (xmlHttp4.readyState < 4) {
	
         allprice.innerHTML="选定官方标配价格综合统计";
  }
  if (xmlHttp4.readyState == 4) {
    var response = xmlHttp4.responseText;
    
    
    allprice.innerHTML=response;
    document.check.buytotalprice.value=response;
    
  }
}



var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}





function callServer(p) {
  
 var url = "../../loadpropic.asp?id="+p;

 xmlHttp.open("GET", url, true);
 xmlHttp.onreadystatechange = updatePage;
 xmlHttp.send(null);  
  
}

function updatePage() {
 if (xmlHttp.readyState < 4) {
	//zhanshipic.innerHTML="loading...";
 }
 if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	zhanshipic.innerHTML=response;
 }
}

//价格初始化
function callServerprice(p) {
  
  var url = "../../selectprice.asp?t=6&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageprice;
  xmlHttp.send(null);  
  
}

function updatePageprice() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

   var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var strbasePrice=strs[0];
    var strproprice19=strs[1];
    var strproprice20=strs[2];
    var strproprice21=strs[3];
    var strproprice34=strs[4];
    var strproprice35=strs[5];
    var strproprice36=strs[6];
    var strproprice37=strs[7];  
    var strpamount=strs[8]; 
    var strid=strs[9]; 
    var alltotalprice=getFloat((strbasePrice*strpamount),2);
      
      document.check.basePrice.value=strbasePrice;
      document.check.strbasePrice.value=strbasePrice;
      document.check.pprice.value=strproprice34;
      document.check.xhprice.value=strproprice21;
      document.check.proprice19.value=strproprice19;
      document.check.proprice20.value=strproprice20;
      document.check.proprice21.value=strproprice21;
      document.check.proprice34.value=strproprice34;
      document.check.proprice35.value=strproprice35;
      document.check.proprice36.value=strproprice36;
      document.check.proprice37.value=strproprice37;
      document.check.buysummoney.value=alltotalprice;
      document.getElementById("pamount_"+strid).value=strpamount;
      document.getElementById("SumMoney").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("gouwuprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
     //$('gouwuprice').innerHTML=''+getFloat(alltotalprice,2)+'';
    // $('allprice').innerHTML=''+getFloat(alltotalprice,2)+'';

      //document.getElementById("allprice").innerHTML=alltotalprice;
     // document.getElementById("gouwuprice").innerHTML=alltotalprice;
     // document.check.buysummoney.value=response;
     // document.check.buytotalprice.value=response;
     //document.check.buygouwuprice.value=response;


  }
}





var xmlHttp1 = false;
try {
  xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp1 = false;
  }
}
if (!xmlHttp1 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp1 = new XMLHttpRequest();
}

//规格选择后价格变化
function selectguige(p) {
  
  var url = "../../selectprice.asp?t=10&id="+p;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updateselect;
  xmlHttp1.send(null);  
  
}

function updateselect() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

   var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var strproprice=strs[0];
    var pricetypeid=strs[1];
    var strid=strs[2];
    strid=parseInt(strid);
      pricetypeid=parseInt(pricetypeid);
 document.getElementById("proprice"+pricetypeid).value=getFloat(strproprice,2);
  
    var basePrice=document.check.strbasePrice.value;
    var strproprice19=document.check.proprice19.value;
    var strproprice20=document.check.proprice20.value;
    var strproprice21=document.check.proprice21.value;
    var strproprice34=document.check.proprice34.value;
    var strproprice35=document.check.proprice35.value;
    var strproprice36=document.check.proprice36.value;
    var strproprice37=document.check.proprice37.value; 
    var strpamount=document.getElementById("pamount_"+strid).value;
         basePrice=getFloat(basePrice,2);
        strproprice19=getFloat(strproprice19,2);
        strproprice20=getFloat(strproprice20,2);
        strproprice21=getFloat(strproprice21,2);
        strproprice34=getFloat(strproprice34,2);
        strproprice35=getFloat(strproprice35,2);
        strproprice36=getFloat(strproprice36,2);
        strproprice37=getFloat(strproprice37,2);

    
      if(pricetypeid==19){
         strproprice19=strproprice;

      }
      else if(pricetypeid==20){

       strproprice20=strproprice;

      }

      else if(pricetypeid==21){

       strproprice21=strproprice;

      }

      else if(pricetypeid==34){

       strproprice34=strproprice;

      }
      else if(pricetypeid==35){

       strproprice35=strproprice;

      }

      else if(pricetypeid==36){

       strproprice36=strproprice;

      }

      else if(pricetypeid==37){

       strproprice37=strproprice;

      }


var  mybasePrice=0;

      if(strproprice34>0){
         mybasePrice=(parseFloat(strproprice34)+parseFloat(strproprice19)+parseFloat(strproprice20)+parseFloat(strproprice21)+parseFloat(strproprice35)+parseFloat(strproprice36)+parseFloat(strproprice37));
			
                        
		}
       else{

         
         mybasePrice=(parseFloat(basePrice)+parseFloat(strproprice19)+parseFloat(strproprice20)+parseFloat(strproprice21)+parseFloat(strproprice35)+parseFloat(strproprice36)+parseFloat(strproprice37));           

            }



    var alltotalprice=getFloat(mybasePrice*strpamount,2);
    //var alltotalprice=mybasePrice;   

     

      document.check.buysummoney.value=alltotalprice;

      document.getElementById("SumMoney").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("gouwuprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("gouwuprice").innerHTML=''+getFloat(alltotalprice,2)+'';
     // document.check.buysummoney.value=response;
     // document.check.buytotalprice.value=response;
     //document.check.buygouwuprice.value=response;
  }
}

//---------
//加入购物车按钮后购物车商品数量
function cartnum() {
  
  var url = "../../selectprice.asp?t=13";

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatecartnum;
  xmlHttp1.send(null);  
  
}

function updatecartnum() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

  

  var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];


  var cartnum=getFloat(cartnum,2);
  var cartsum=getFloat(cartsum,2);


  document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
    
  }
}

//----

//配件选定价格变化
function addpeijian(p) {
  
  var url = "../../selectprice.asp?t=11&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updateaddpeijian;
  xmlHttp.send(null);  
  
}

function updateaddpeijian() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

   var str = xmlHttp.responseText;

  var myprice=getFloat(str,2);
  var  strbuygouwuprice =  $("buygouwuprice").value;
  var  strbuypeijianprice=   $("buypeijianprice").value;
  var  strbuysummoney =   $("buysummoney").value;

  strbuypeijianprice=(parseFloat(getFloat(strbuypeijianprice,2))+parseFloat(getFloat(myprice,2))).toFixed(2)

  var alltotalprice=(parseFloat(getFloat(strbuysummoney,2))+parseFloat(getFloat(strbuypeijianprice,2))).toFixed(2)

 $("buypeijianprice").value=getFloat(strbuypeijianprice,2);


  document.getElementById("peijianprice").innerHTML=''+getFloat(strbuypeijianprice,2)+'';
  document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
     cartnum();
  }
}


//配件删除价格变化
function delpeijian(p) {
  
  var url = "../../selectprice.asp?t=12&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatedelpeijian;
  xmlHttp.send(null);  
  
}

function updatedelpeijian() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   

   var str = xmlHttp.responseText;
   var myprice=getFloat(str,2);
  var  strbuygouwuprice =  $("buygouwuprice").value;
  var  strbuypeijianprice=   $("buypeijianprice").value;
  var  strbuysummoney =   $("buysummoney").value;

  strbuypeijianprice=(parseFloat(getFloat(strbuypeijianprice,2))-parseFloat(getFloat(myprice,2))).toFixed(2)


  var alltotalprice=(parseFloat(getFloat(strbuysummoney,2))+parseFloat(getFloat(strbuypeijianprice,2))).toFixed(2)

  $("buypeijianprice").value=getFloat(strbuypeijianprice,2);

  document.getElementById("peijianprice").innerHTML=''+getFloat(strbuypeijianprice,2)+'';
  document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
     cartnum();
  }
}


//快速选购价格变化
function addtofastcart(p) {
  
  var url = "../../selectprice.asp?t=14&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updateaddfastcart;
  xmlHttp.send(null);  
  
}

function updateaddfastcart() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {

  

   
 cartnum();
    
  }
  
}



//颜色选择更新图片
function callServercolor(p) {
  
 var url = "../../loadpropic.asp?id="+p;

 xmlHttp0.open("GET", url, true);

  xmlHttp0.onreadystatechange = updatePagecolor;
 xmlHttp0.send(null);  
  
}

function updatePagecolor() {
if (xmlHttp0.readyState < 4) {
	
   document.getElementById("zhanshipic").innerHTML="";
       
 }
 if (xmlHttp0.readyState == 4) {
   var response = xmlHttp0.responseText;
   document.getElementById("zhanshipic").innerHTML=response;
     
 }
}

//颜色选择更新选定状态

function callServercolorselect(p) {
  
  var url = "../../select.asp?t=1&id="+p;

  xmlHttp0.open("GET", url, true);
  xmlHttp0.onreadystatechange = updatePagecolorselect;
  xmlHttp0.send(null);  
  
}

function updatePagecolorselect() {
  if (xmlHttp0.readyState < 4) {
	document.getElementById("yixuancolor").innerHTML="";
  }
  if (xmlHttp0.readyState == 4) {
  var str = xmlHttp0.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
   sok=parseInt(sok);
 var titleselectname=selectname.replace("+","");  
 var selectpic1="<img src='"+selectpic+"' border='0'    height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuancolor").innerHTML=selectname;
}

if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}




   
  }
}




//更新尺寸选定状态
function callServersizeselect(p) {
  
  var url = "../../select.asp?t=2&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagesizeselect;
  xmlHttp.send(null);  
  
}

function updatePagesizeselect() {
  if (xmlHttp.readyState < 4) {
	yixuansize.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {

 var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuansize").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}


  
	
  }
}

//更新配件选定状态
function callServerpjselect(p) {
  
  var url = "../../select.asp?t=5&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagepjselect;
  xmlHttp.send(null);  
  
}

function updatePagepjselect() {
  if (xmlHttp.readyState < 4) {
	yixuansize.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {

 var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuanpeijian").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}


  
	
  }
}


//更新长度选定状态
var xmlHttp6 = false;
try {
  xmlHttp6 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp6 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp6 = false;
  }
}
if (!xmlHttp6 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp6 = new XMLHttpRequest();
}


function callServerlongselect(p) {
  
  var url = "../../select.asp?t=7&id="+p;

  xmlHttp6.open("GET", url, true);
  xmlHttp6.onreadystatechange = updatePagelongselect;
  xmlHttp6.send(null);  
  
}

function updatePagelongselect() {
  if (xmlHttp6.readyState < 4) {
	yixuanlong.innerHTML="";
  }
  if (xmlHttp6.readyState == 4) {

var str = xmlHttp6.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuanlong").innerHTML=selectname;
}

if(sok==1){
document.getElementById("zhanshipic").innerHTML=selectpic1;
}



  
	
  }
}


//更新宽度选定状态
function callServerwidthselect(p) {
  
  var url = "../../select.asp?t=8&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagewidthselect;
  xmlHttp.send(null);  
  
}

function updatePagewidthselect() {
  if (xmlHttp.readyState < 4) {
	yixuanwidth.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {


 var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
   sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>"

if(selectname!==0){
   document.getElementById("yixuanwidth").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}

  
	
  }
}

//配件选定更新购物车

function callServerkxpjon(kxpjid) {
  
  var url = "../../addcart.asp?id="+kxpjid;

  xmlHttp1.open("GET", url, true);
  //xmlHttp1.onreadystatechange = updatePagekxpjon;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjon() {
  if (xmlHttp1.readyState < 4) {
	mycarto.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	mycarto.innerHTML="";
  }
}
//配件删除更新购物车
function callServerkxpjdown(kxpjid) {
  
  var url = "../../delcart.asp?id="+kxpjid;

  xmlHttp1.open("GET", url, true);
  //xmlHttp1.onreadystatechange = updatePagekxpjdown;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjdown() {
  if (xmlHttp1.readyState < 4) {
	mycarto.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	mycarto.innerHTML=response;
  }
}


//配件选定统计价格总数





function callServerkxpjontj(kxpjid,g,id) {
  
  var url = "../../addcarttj.asp?pid="+kxpjid+"&g="+g+"&id="+id;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatePagekxpjontj;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjontj() {
  if (xmlHttp1.readyState < 4) {
	allprice.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	allprice.innerHTML=response;
         document.check.buytotalprice.value=response;
  }
}

//配件选定配件统计价格总数


function callServerkxpjontjpj(kxpjid,g) {
  
  var url = "../../addcarttjpj.asp?pid="+kxpjid+"&g="+g;

  xmlHttp2.open("GET", url, true);
  xmlHttp2.onreadystatechange = updatePagekxpjontjpj;
  xmlHttp2.send(null);  
  
}

function updatePagekxpjontjpj() {
  if (xmlHttp2.readyState < 4) {
	peijianprice.innerHTML="";
  }
  if (xmlHttp2.readyState == 4) {
    var response = xmlHttp2.responseText;
	peijianprice.innerHTML=response;
         document.check.buypeijianprice.value=response;
  }
}

//配件删除统计价格总数

function callServerkxpjdowntj(kxpjid,g,id) {
  
  var url = "../../delcarttj.asp?pid="+kxpjid+"&g="+g+"&id="+id;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatePagekxpjontj;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjontj() {
  if (xmlHttp1.readyState < 4) {
	allprice.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	allprice.innerHTML=response;
         document.check.buytotalprice.value=response;
  }
}


var xmlHttp2 = false;
try {
  xmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp2 = false;
  }
}
if (!xmlHttp2 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp2 = new XMLHttpRequest();
}


//配件删除配件统计价格总数


function callServerkxpjdowntjpj(kxpjid,g) {
  
  var url = "../../delcarttjpj.asp?pid="+kxpjid+"&g="+g;

  xmlHttp2.open("GET", url, true);
  xmlHttp2.onreadystatechange = updatePagekxpjontjpj;
  xmlHttp2.send(null);  
  
}

function updatePagekxpjontjpj() {
  if (xmlHttp2.readyState < 4) {
	peijianprice.innerHTML="";
  }
  if (xmlHttp2.readyState == 4) {
    var response = xmlHttp2.responseText;
	peijianprice.innerHTML=response;
         document.check.buypeijianprice.value=response;
  }
}

var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}


function callServeraddmycart(id) {
  
   var url = "../../addcartok.asp?pid="+id;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageaddmycart;
  xmlHttp.send(null);  
  
}

function updatePageaddmycart() {
  if (xmlHttp.readyState < 4) {
	 //document.getElementById("topcart").innerHTML="loading...";

  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
        document.getElementById("topcart").innerHTML=response;
     
  }
}

function callServeraddbottomcart() {
  
   var url = "../../addcartbottomok.asp";

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageaddbottomcart;
  xmlHttp.send(null);  
  
}

function updatePageaddbottomcart() {
  if (xmlHttp.readyState < 4) {
	// document.getElementById("bottomrightcart").innerHTML="loading...";

  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
       
     document.getElementById("bottomrightcart").innerHTML=response;
  }
}



//商品详细页面加入购物车

function addcart1(pid)
{	
         var  pid
        
    callServeraddcart(pid);
          alert('已经加入购物车！');
           
 }  



function callServeraddcart(pid) {
  
   var url = "../../protoaddcart.asp?pid="+pid;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageaddtocart;
  xmlHttp.send(null);  
  
}

function updatePageaddtocart() {
  if (xmlHttp.readyState < 4) {
	mycarto.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	mycarto.innerHTML=response;
  }
}


function ajaxdiy(pid,bid,t) {
  
   var url = "../../diycookie.asp?pid="+pid+"&bid="+bid+"&t="+t;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagediy;
  xmlHttp.send(null);  
  
}

function updatePagediy() {
  if (xmlHttp.readyState < 4) {
	slpid.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {
    var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var proname=strs[0];
    var proprice=strs[1];
    var bid=strs[2];
     bid=bid.replace(/[ ]/g,""); 
    bid=parseInt(bid)
       
    //var (proname_"+bid)="未选";
  //proname_1.innerHTML="ok";
  //("proname_"+bid)=strs[1];
   
  //proname_"+bid.innerHTML=proname;  
   document.getElementById("proname_"+bid).innerHTML=proname;
   document.getElementById("allprice").innerHTML=proprice;
  }
}


function ajaxdiynum(pid,nid) {
  
   var url = "../../diycookienum.asp?pid="+pid+"&nid="+nid;

  xmlHttp.open("GET", url, true);

  xmlHttp.send(null);  
  
}


function addcart_list(id) {
  
 var url = "../../loadguige.asp?id="+id;

 xmlHttp.open("GET", url, true);
 xmlHttp.onreadystatechange = updatePageaddcart_list;
 xmlHttp.send(null);  
  
}

function updatePageaddcart_list() {
 if (xmlHttp.readyState < 4) {
	//zhanshipic.innerHTML="loading...";
 }
 if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;	
   // document.getElementById("addcartguige"+id).innerHTML=response;
    document.getElementById("addcartguige200").innerHTML=response;
 }
}




//列表按钮直接加入购物车

function tominiaddcart(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
tominiaddcartok(id)
}





function tominiaddcartok(p) {
  
 var url = "../../add_minicart.asp?pid="+p;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updatetominiaddcartok;
 xmlHttp.send(null);  
  
}

function updatetominiaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var pid = xmlHttp.responseText;
 // pid="200";
   cartnummini(pid);
   document.getElementById('mycartminiok'+pid).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function cartnummini(pid) {
  
  var url = "../../selectprice.asp?t=13&id="+pid;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updateminicartnum;
  xmlHttp1.send(null);  
  
}

function updateminicartnum() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

  

  var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];

  var cartnum=getFloat(cartnum,2);
  var cartsum=getFloat(cartsum,2);


  document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("mycartmini"+pid).innerHTML=''+getFloat(cartsum,2)+'元';  
  }
}

function tominiaddcartcose(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}
	
//===========================

//商品详细按钮直接加入购物车

function ptominiaddcart(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
ptominiaddcartok(id)
}





function ptominiaddcartok(p) {
  
 var url = "../../add_pminicart.asp?pid="+p;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateptominiaddcartok;
 xmlHttp.send(null);  
  
}

function updateptominiaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var pid = xmlHttp.responseText;
 // pid="200";
   pcartnummini(pid);
   document.getElementById('mycartminiok'+pid).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function pcartnummini(pid) {
  
  var url = "../../selectprice.asp?t=13&id="+pid;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatepminicartnum;
  xmlHttp1.send(null);  
  
}

function updatepminicartnum() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

  

  var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];

  var cartnum=getFloat(cartnum,2);
  var cartsum=getFloat(cartsum,2);


  document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("mycartmini"+pid).innerHTML=''+getFloat(cartsum,2)+'元';  
  }
}

function ptominiaddcartcose(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}
	
//===========================



//首页分类板块按钮直接加入购物车

function classaddcart(id,classid,f) {  
theObj = document.getElementById('miniaddcart_'+id+'_'+classid+'_'+f).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
classaddcartok(id,classid,f)
}





function classaddcartok(id,classid,f) {
  
 var url = "../../add_classminicart.asp?pid="+id+"&cid="+classid+"&f="+f;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateclassaddcartok;
 xmlHttp.send(null);  
  
}

function updateclassaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
  // var pid = xmlHttp.responseText;
 // pid="200";
   var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
  }  
   var pid=strs[0];
    var cid=strs[1];
    var f=strs[2];



   classcartnummini(pid,cid,f);
   document.getElementById('mycartminiok_'+pid+'_'+cid+'_'+f).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function classcartnummini(pid,cid,f) {
  
  var url = "../../selectprice.asp?t=15&id="+pid+"&cid="+cid+"&f="+f;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = classupdateminicartnum;
  xmlHttp.send(null);  
  
}

function classupdateminicartnum() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

  

  var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];
    var cid=strs[3];
    var f=strs[4];
  




   document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("mycartmini_"+pid+"_"+cid+"_"+f).innerHTML=''+cartsum+'元';  

  }
}

function classaddcartcose(id,classid,f) {  
theObj = document.getElementById('miniaddcart_'+id+'_'+classid+'_'+f).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}

//===========================

//首页属性板块按钮直接加入购物车

function shuxingaddcart(id,re,tp) {  
theObj = document.getElementById('shuxingaddcart_'+id+'_'+re+'_'+tp).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
shuxingaddcartok(id,re,tp)
}





function shuxingaddcartok(id,re,tp) {
  
 var url = "../../add_shuxingminicart.asp?pid="+id+"&re="+re+"&tp="+tp;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateshuxingaddcartok;
 xmlHttp.send(null);  
  
}

function updateshuxingaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
  // var pid = xmlHttp.responseText;
 // pid="200";
   var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
  }  
   var pid=strs[0];
    var re=strs[1];
    var tp=strs[2];



   shuxingcartnummini(pid,re,tp);
   document.getElementById('shuxingcartminiok_'+pid+'_'+re+'_'+tp).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function shuxingcartnummini(pid,re,tp) {
  
  var url = "../../selectprice.asp?t=16&id="+pid+"&re="+re+"&tp="+tp;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = shuxingupdateminicartnum;
  xmlHttp.send(null);  
  
}

function shuxingupdateminicartnum() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

  

  var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];
    var re=strs[3];
    var tp=strs[4];
  




   document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("shuxingcartmini_"+pid+"_"+re+"_"+tp).innerHTML=''+cartsum+'元';  

  }
}

function shuxingaddcartcose(id,re,tp) {  
theObj = document.getElementById('shuxingaddcart_'+id+'_'+re+'_'+tp).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}


function tocomparecart(id) {
  displaycomparecart();
 var url = "../../add_compare.asp?pid="+id;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updatetocomparecartok;
 xmlHttp.send(null);  
  
}

function updatetocomparecartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
if (xmlHttp.readyState == 4) {
 var strcomparenum = xmlHttp.responseText;
  
   if(strcomparenum!=3){
   
   document.getElementById('comparebody').innerHTML=xmlHttp.responseText;
  }
  else{

   document.getElementById('compareupto').innerHTML="对比内容已经超过4个了";

  }   
 }
}

function emptycomparecart() {
  
 var url = "../../empty_compare.asp";

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateemptycomparecartok;
 xmlHttp.send(null);  
  
}

function updateemptycomparecartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var pid = xmlHttp.responseText;
 // pid="200";
 
  document.getElementById('comparebody').innerHTML="已经清空！";
     
 }
}


//隐藏对比框

function displaycomparecart() {  
theObj = document.getElementById('comparecart').style;  
if (  theObj.display == "block" ) theObj.display = "block"; else theObj.display = "block";

}
//显示对比框
function hidecomparecart() {  
theObj = document.getElementById('comparecart').style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";

}
	
//保留float型参数value小数点后len位
 function getFloat(value,len)
 {
  //如果value为数值型,需要先将value转换成字符串型
  //否则,使用indexOf和substr时会报错
  var str = value.toString();
  
  //若len不为int型,则小数部分将被忽略
  var i = parseInt( len );
  var index = str.indexOf( "." );
  
  var int_length = str.substr(0, index).length;
  
  //value值必须为数值
  if ( isNaN ( str ) )
  {
   alert("数值无效");
   return "";
  }
  
  //精度值必须为数值
  if ( isNaN ( i ) )
  {
   alert("精度值无效.");
   return "";
  }
  
  //精度值不能小于0,允许等于0,等于0返回value的整数部分
  if ( i < 0 )
  {
   alert("精度不应小于0.");
   return "";
  }
  
  //如果value为整数,直接返回;
  if ( index == -1 )
  {
   return str;
  }
  
  var temp_value = 0.0;
  
  //精度等于0返回value的整数部分
  if ( i == 0 )
  {
   return str.substr( 0, int_length);
  }
  //精度大于零返回value值小数点后i位数值,或i大于value小数后位数,则返回整个value
  else
  {
   temp_value = parseFloat( str.substr( 0, int_length + len + 2 ) );
  }
  
  //进行四舍五入动作
  
  //如果value中小数位数<=精度值,则直接返回,不需要做四舍五入处理
  if ( ( str.length - index - 1 ) <= len )
  {
   return temp_value.toString();
  }
  
  var decimal = 0.5;
  //计算
  for ( j = 0; j < i; j++ )
  {
   decimal = decimal / 10;
  }
  return ( temp_value + decimal ).toString().substr( 0, temp_value.toString().length - 1 );
 }







	
